import { useMenuStore } from '@/store/menu';
import router from '@/router';
function checkPermission (el, binding) {
  const { value } = binding;
  const permissionInfo = useMenuStore().permissionInfo;
  // const permissionRoles = value;
  /* 判断当前页面对应的按钮（或者节点）是否可以显示 */
  const hasPermission = permissionInfo['w_' + router.currentRoute.value.name].includes(value);
  if (!hasPermission) {
    el.parentNode && el.parentNode.removeChild(el);
  }
}

export default {
  mounted (el, binding) {
    checkPermission(el, binding);
  },
  // update (el, binding) {
  //   checkPermission(el, binding);
  // }
}
